package com.anycl.design.principle.ocp;

public class FinanceBenzCar extends BenzCar {
    public FinanceBenzCar(String name, int price) {
        super(name, price);
    }

    @Override
    public int getPrice() {
        int selfPrice = super.getPrice();
        int financePrice = 0;
        if (selfPrice >= 100) {
            financePrice = selfPrice + selfPrice * 5 / 100;
        } else if (selfPrice >=50) {
            financePrice = selfPrice + selfPrice * 2 / 100;
        } else {
            financePrice = selfPrice;
        }

        return financePrice;
    }
}
